package com.syni.mdd.yhd.common.all.controller.protect;

/**
 * @className BmsBusinessController
 * @description TOO
 * @Author cfx
 * @DATE 2019/4/15 14:25
 * @VERSION 1.0
 **/

import com.syni.mdd.sjb.common.component.utils.common.annotations.CheckParams;
import com.syni.mdd.yhd.common.all.constants.ResultMsg;
import com.syni.mdd.yhd.common.all.service.BmsUserBusinessFocusService;
import com.syni.mdd.sjb.common.component.utils.common.utils.ParamsMap;
import com.syni.mdd.sjb.common.component.utils.common.utils.ResultMapHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/userBusinessFocus")
public class BmsUserBusinessFocusController {

    @Autowired
    BmsUserBusinessFocusService bmsUserBusinessFocusService;

    /*@PostMapping("/getMyFocusVideo")
    @EntranceCheck(checkAuth = true,params = {"pageNum","pageSize"})
    public Map<String,Object> getMyFocusVideo(@RequestBody BaseReDto baseReDto){
        Integer userId = Integer.parseInt(baseReDto.getUserId());
        Integer pageNum = baseReDto.getPageNum();
        Integer pageSize = baseReDto.getPageSize();
        return bmsUserBusinessFocusService.getMyFocusVideo(userId,pageNum,pageSize);
    }*/

    @PostMapping("/getMyBusinessFoucsNum")
    @ResponseBody
    @CheckParams(checkAuth = true,params = {"businessId"})
    public Map<String,Object> getMyBusinessFoucsNum(@RequestBody ParamsMap paramsMap){
        Integer businessId = paramsMap.getInteger("businessId");
        return bmsUserBusinessFocusService.getMyBusinessFoucsNum(businessId);

    }

    @PostMapping("/checkUserIsFocusBusiness")
    @ResponseBody
    @CheckParams(checkAuth = true,params = {"businessId"})
    public Map<String,Object> checkUserIsFocusBusiness(@RequestBody ParamsMap paramsMap){
        Integer userId = paramsMap.getInteger("userIdentify");
        Integer businessId = paramsMap.getInteger("businessId");
        return ResultMapHelper.success(bmsUserBusinessFocusService.findUserFouce(userId,businessId), ResultMsg.MSG_GET_SUCCESS);

    }

}
